/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vamprest;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author sav
 */
@Entity
@Table(name = "poicomment")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Poicomment.findAll", query = "SELECT p FROM Poicomment p"),
    @NamedQuery(name = "Poicomment.findByIdpoicomment", query = "SELECT p FROM Poicomment p WHERE p.idpoicomment = :idpoicomment"),
    @NamedQuery(name = "Poicomment.findByDatetime", query = "SELECT p FROM Poicomment p WHERE p.datetime = :datetime")})
public class Poicomment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "idpoicomment")
    private Integer idpoicomment;
    @Basic(optional = false)
    @NotNull
    @Column(name = "datetime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datetime;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "comment")
    private String comment;
    @JoinColumn(name = "idpoi", referencedColumnName = "idpoi")
    @ManyToOne(optional = false)
    private Poi idpoi;
    @JoinColumn(name = "idmember", referencedColumnName = "idmember")
    @ManyToOne(optional = false)
    private Member idmember;

    public Poicomment() {
    }

    public Poicomment(Integer idpoicomment) {
        this.idpoicomment = idpoicomment;
    }

    public Poicomment(Integer idpoicomment, Date datetime, String comment) {
        this.idpoicomment = idpoicomment;
        this.datetime = datetime;
        this.comment = comment;
    }

    public Integer getIdpoicomment() {
        return idpoicomment;
    }

    public void setIdpoicomment(Integer idpoicomment) {
        this.idpoicomment = idpoicomment;
    }

    public Date getDatetime() {
        return datetime;
    }

    public void setDatetime(Date datetime) {
        this.datetime = datetime;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Poi getIdpoi() {
        return idpoi;
    }

    public void setIdpoi(Poi idpoi) {
        this.idpoi = idpoi;
    }

    public Member getIdmember() {
        return idmember;
    }

    public void setIdmember(Member idmember) {
        this.idmember = idmember;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpoicomment != null ? idpoicomment.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Poicomment)) {
            return false;
        }
        Poicomment other = (Poicomment) object;
        if ((this.idpoicomment == null && other.idpoicomment != null) || (this.idpoicomment != null && !this.idpoicomment.equals(other.idpoicomment))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vamprest.Poicomment[ idpoicomment=" + idpoicomment + " ]";
    }

}
